import React from 'react'

export const FieldOne:React.FC =() => {
  const fun = (nu: any) => {
    if(nu > 10) return nu
    console.log(12123);
    
    if(nu<5){
      return {name:'1'}
    }else{
      return {name:'2'}
    }
    
  }
  const result1 = fun(11);
  // const result2 = fun(1);
  // const result3 = fun(7);

  console.log('result1返回的结果为：',result1);
  // console.log('result2返回的结果为：',result2);
  // console.log('result3返回的结果为：',result3);

  const array = [
    { id: 3 },
    { id: '' },
    { id: false },
    0,
    1,
    [1,2],
  ]
  const newArr = array.filter(( el ) =>  el )
  console.log(newArr);

  const filterConfig = (config: any, params: any) =>{
    return config.filter((item: any) =>{
      return params.find((el: any) => el.fieldName === item.fieldName)
    }
    )
  }
    

const config = [
  { fieldName: 'name', type: 'text' },
  { fieldName: 'age', type: 'number' },
  { fieldName: 'email', type: 'email' },
  { fieldName: 'address', type: 'text' },
];

const params = [
  { fieldName: 'name' },
  { fieldName: 'email' },
];

const filteredConfig = filterConfig(config, params);

console.log(filteredConfig);

    return (
      <>
      <div>FieldOne</div>
      </>
    )
  }
